﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TimKenSite.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="TimKen.Web.User.Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="../Common/Script/common.js" type="text/javascript"></script>
<link href="../Common/Style/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

    $(document).ready(function () {
          $("#hidintcs").val('<%= Session["intcode"] != null ? Session["intcode"] : "0" %>');
       
//        $("#UserName").focus(function () {
//            $(this).attr({ style: "border-color:#FFA91A;" });
//            if ($(this).val() == '<%= GetLangString("UserName")%>')  
//                $(this).attr("value", "");
//        });
//        $("#UserName").blur(function () {
//            $(this).attr({ style: "border-color:#c1c1c1;" });
//            if ($(this).val() == "") {
//                $(this).attr("value", '<%= GetLangString("UserName")%>');
//            }
//        });

//        $("#txt_code").focus(function () {
//            $(this).attr({ style: "border-color:#FFA91A;" });
//            if ($(this).val() == '<%= GetLangString("YourCode")%>')
//                $(this).attr("value", "");
//        });
//        $("#txt_code").blur(function () {
//            $(this).attr({ style: "border-color:#c1c1c1;" });
//            if ($(this).val() == "") {
//                $(this).attr("value", '<%= GetLangString("YourCode")%>');
//            }
//        });

//        $("#Password").focus(function () {
//            $("#pd").css("visibility", "hidden"); //.hide();
//        });
//        $("#Password").blur(function () {
//            if ($("#Password").val() == "")
//                $("#pd").css("visibility", "visible"); //.show();
//        });
        var intclick = parseInt($("#hidintcs").val());
        if (intclick >= 2) {
            $("#span_yzmaa").show();
        }
        else {
            $("#span_yzmaa").hide();
        }
        //响应回车时间
        $(document).keyup(function (e) {
            if (e.keyCode === 13) {
                userlogin();
            }
        });
    });
    function userloginaa() {
        var intclick = parseInt($("#hidintcs").val());
        if (intclick >= 2) {
            $("#span_yzmaa").show();
        }
        else {
            $("#span_yzmaa").hide();
        }
        $("#hidintcs").val(intclick + 1);
        if (document.getElementById("UserNameaa").value == "") {
            alert('<%= GetLangString("x_UserNameNotAllowBlank")%>');
            return false;
        }
        else if (document.getElementById("Passwordaa").value == "") {
            alert('<%= GetLangString("x_PasswordNotAllowBlank")%>');
            return false;
        }
        else {
            if (intclick >= 2) {
                if ($("#txt_codeaa").val().length <= 0 || $("#txt_codeaa").val() == "") {
                    alert('<%= GetLangString("x_CodeNotAllowBlank")%>');
                    return false;
                } else {
                    ChangeCheckedaa(); // jqGetUrl(intclick)
                    document.location = '/User/Login.aspx?UserName=' + document.getElementById("UserNameaa").value + '&Password=' + document.getElementById("Passwordaa").value + '&TxtCode=' + $("#txt_codeaa").val() + '&intcode=' + intclick;
                }
            } else {
                ChangeCheckedaa(); //jqGetUrl(intclick)
                document.location = '/User/Login.aspx?UserName=' + document.getElementById("UserNameaa").value + '&Password=' + document.getElementById("Passwordaa").value + '&TxtCode=' + $("#txt_codeaa").val() + '&intcode=' + intclick;
            }
        }
        function jqGetUrlaa(intclick) {
            $.get("'/User/Login.aspx", { UserName: document.getElementById("UserNameaa").value,
                Password: document.getElementById("Passwordaa").value,
                TxtCode: $("#txt_codeaa").val(),
                intcode: intclick
            });
        }
        function ChangeCheckedaa() {
            var cb = document.getElementById('cbSaveUserNameaa');
            if (cb.checked) {
                setcookie("username", document.getElementById('UserNameaa').value, 3000000);
            } else {
                setcookie("username", "", 3000000);
            }
        }
    }
    function setNameValueaa() {
        var cb = document.getElementById('cbSaveUserNameaa');
        if (cb) {
            var username = getcookie('username');
            if (username == "" || username == null || username == ";") {
                cb.checked = false;
            } else {
                document.getElementById("UserNameaa").value = getcookie('username');
                cb.checked = true;
            }
        }
    }
    function loginKeyDownaa(evt) {
        if (Util.getCode(evt) === "13") {
            userloginaa();
        }
        //        var key = 0, evt = evt || event;
        //        key = evt.keyCode || evt.which || evt.charCode;  
        //        if (key == 13) {
        //            userlogin();
        //        } 
    }
    function getimgcodeaa() {
        var getimagecode = document.getElementById("getcodeaa");
        getimagecode.src = "../ashx/ValidateCode.ashx?stamp=" + Math.random();
    }
    function addCookieaa(objValue) {
        document.location = '/User/Login.aspx?language=' + objValue;
    }
</script>
<style type="text/css">
    .btndisplay
    {
        display: none;
    }
    *html #pd
    {
        border: none;
        font-size: 12px;
        color: #acacac;
        position: relative;
        top: -27px;
        margin-right: -35px;
        font-family: @宋体;
    }
    #pd
    {
        border: none;
        font-size: 12px;
        color: #acacac;
        position: relative;
        top: 1px;
        margin-right: -35px;
        font-family: @宋体;
    }
    .spanwhith
    {
        width: 80px;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Title" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="body" runat="server">
    <form id="form1" runat="server">
 
  
    </form>
</asp:Content>
